package com.xckj.cycling.activity

import android.os.Bundle
import android.view.View
import com.junca.android.base.CViewBinding
import com.xckj.cycling.databinding.ActivityNavigationBinding
import com.xckj.cycling.framework.BaseActivityKt

/**
 * 导航页面
 */
class NavigationActivity : BaseActivityKt() {

    @CViewBinding
    lateinit var viewBinding: ActivityNavigationBinding
    override fun initView(root: View, savedInstanceState: Bundle?) {
        super.initView(root, savedInstanceState)
        lifecycle.addObserver(viewBinding.maps)
        viewModel.routes.observe(this) {
            viewBinding.maps.drawRoute(it)
        }
        viewModel.endName.observe(this) {
            viewBinding.titlebar.tvTitle.text = it
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        viewBinding.maps.navigation.setNavigationRoutes(emptyList())
    }

}